﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace IPC.Communication.BasicFramework
{
    [Serializable]
    public sealed class SystemVersion
    {
        private int m_MainVersion = 2;

        private int m_SecondaryVersion = 0;

        private int m_EditVersion = 0;

        private int m_InnerVersion = 0;

        public int MainVersion
        {
            get
            {
                return this.m_MainVersion;
            }
        }

        public int SecondaryVersion
        {
            get
            {
                return this.m_SecondaryVersion;
            }
        }

        public int EditVersion
        {
            get
            {
                return this.m_EditVersion;
            }
        }

        public int InnerVersion
        {
            get
            {
                return this.m_InnerVersion;
            }
        }

        public SystemVersion(string VersionString)
        {
            string[] array = VersionString.Split(new char[]
			{
				'.'
			}, StringSplitOptions.RemoveEmptyEntries);
            bool flag = array.Length >= 1;
            if (flag)
            {
                this.m_MainVersion = Convert.ToInt32(array[0]);
            }
            bool flag2 = array.Length >= 2;
            if (flag2)
            {
                this.m_SecondaryVersion = Convert.ToInt32(array[1]);
            }
            bool flag3 = array.Length >= 3;
            if (flag3)
            {
                this.m_EditVersion = Convert.ToInt32(array[2]);
            }
            bool flag4 = array.Length >= 4;
            if (flag4)
            {
                this.m_InnerVersion = Convert.ToInt32(array[3]);
            }
        }

        public SystemVersion(int main, int sec, int edit)
        {
            this.m_MainVersion = main;
            this.m_SecondaryVersion = sec;
            this.m_EditVersion = edit;
        }

        public SystemVersion(int main, int sec, int edit, int inner)
        {
            this.m_MainVersion = main;
            this.m_SecondaryVersion = sec;
            this.m_EditVersion = edit;
            this.m_InnerVersion = inner;
        }

        public string ToString(string format)
        {
            bool flag = format == "C";
            string result;
            if (flag)
            {
                result = string.Format("{0}.{1}.{2}.{3}", new object[]
				{
					this.MainVersion,
					this.SecondaryVersion,
					this.EditVersion,
					this.InnerVersion
				});
            }
            else
            {
                bool flag2 = format == "N";
                if (flag2)
                {
                    result = string.Format("{0}.{1}.{2}", this.MainVersion, this.SecondaryVersion, this.EditVersion);
                }
                else
                {
                    bool flag3 = format == "S";
                    if (flag3)
                    {
                        result = string.Format("{0}.{1}", this.MainVersion, this.SecondaryVersion);
                    }
                    else
                    {
                        result = this.ToString();
                    }
                }
            }
            return result;
        }

        public override string ToString()
        {
            bool flag = this.InnerVersion == 0;
            string result;
            if (flag)
            {
                result = this.ToString("N");
            }
            else
            {
                result = this.ToString("C");
            }
            return result;
        }

        public override bool Equals(object obj)
        {
            return base.Equals(obj);
        }

        public override int GetHashCode()
        {
            return base.GetHashCode();
        }

        public static bool operator ==(SystemVersion SV1, SystemVersion SV2)
        {
            bool flag = SV1.MainVersion != SV2.MainVersion;
            bool result;
            if (flag)
            {
                result = false;
            }
            else
            {
                bool flag2 = SV1.SecondaryVersion != SV2.SecondaryVersion;
                if (flag2)
                {
                    result = false;
                }
                else
                {
                    bool flag3 = SV1.m_EditVersion != SV2.m_EditVersion;
                    if (flag3)
                    {
                        result = false;
                    }
                    else
                    {
                        bool flag4 = SV1.InnerVersion != SV2.InnerVersion;
                        result = !flag4;
                    }
                }
            }
            return result;
        }

        public static bool operator !=(SystemVersion SV1, SystemVersion SV2)
        {
            bool flag = SV1.MainVersion != SV2.MainVersion;
            bool result;
            if (flag)
            {
                result = true;
            }
            else
            {
                bool flag2 = SV1.SecondaryVersion != SV2.SecondaryVersion;
                if (flag2)
                {
                    result = true;
                }
                else
                {
                    bool flag3 = SV1.m_EditVersion != SV2.m_EditVersion;
                    if (flag3)
                    {
                        result = true;
                    }
                    else
                    {
                        bool flag4 = SV1.InnerVersion != SV2.InnerVersion;
                        result = flag4;
                    }
                }
            }
            return result;
        }

        public static bool operator >(SystemVersion SV1, SystemVersion SV2)
        {
            bool flag = SV1.MainVersion > SV2.MainVersion;
            bool result;
            if (flag)
            {
                result = true;
            }
            else
            {
                bool flag2 = SV1.MainVersion < SV2.MainVersion;
                if (flag2)
                {
                    result = false;
                }
                else
                {
                    bool flag3 = SV1.SecondaryVersion > SV2.SecondaryVersion;
                    if (flag3)
                    {
                        result = true;
                    }
                    else
                    {
                        bool flag4 = SV1.SecondaryVersion < SV2.SecondaryVersion;
                        if (flag4)
                        {
                            result = false;
                        }
                        else
                        {
                            bool flag5 = SV1.EditVersion > SV2.EditVersion;
                            if (flag5)
                            {
                                result = true;
                            }
                            else
                            {
                                bool flag6 = SV1.EditVersion < SV2.EditVersion;
                                if (flag6)
                                {
                                    result = false;
                                }
                                else
                                {
                                    bool flag7 = SV1.InnerVersion > SV2.InnerVersion;
                                    if (flag7)
                                    {
                                        result = true;
                                    }
                                    else
                                    {
                                        bool flag8 = SV1.InnerVersion < SV2.InnerVersion;
                                        result = (flag8 && false);
                                    }
                                }
                            }
                        }
                    }
                }
            }
            return result;
        }

        public static bool operator <(SystemVersion SV1, SystemVersion SV2)
        {
            bool flag = SV1.MainVersion < SV2.MainVersion;
            bool result;
            if (flag)
            {
                result = true;
            }
            else
            {
                bool flag2 = SV1.MainVersion > SV2.MainVersion;
                if (flag2)
                {
                    result = false;
                }
                else
                {
                    bool flag3 = SV1.SecondaryVersion < SV2.SecondaryVersion;
                    if (flag3)
                    {
                        result = true;
                    }
                    else
                    {
                        bool flag4 = SV1.SecondaryVersion > SV2.SecondaryVersion;
                        if (flag4)
                        {
                            result = false;
                        }
                        else
                        {
                            bool flag5 = SV1.EditVersion < SV2.EditVersion;
                            if (flag5)
                            {
                                result = true;
                            }
                            else
                            {
                                bool flag6 = SV1.EditVersion > SV2.EditVersion;
                                if (flag6)
                                {
                                    result = false;
                                }
                                else
                                {
                                    bool flag7 = SV1.InnerVersion < SV2.InnerVersion;
                                    if (flag7)
                                    {
                                        result = true;
                                    }
                                    else
                                    {
                                        bool flag8 = SV1.InnerVersion > SV2.InnerVersion;
                                        result = (flag8 && false);
                                    }
                                }
                            }
                        }
                    }
                }
            }
            return result;
        }
    }
}
